<template>
	<view class="content">
		<image :src="baseUrl+'aiInfo.jpg'" class="aiInfo" />
		<!-- 菜单 -->
		<view class="menuBox">
			<view class="homeBox" @click="$switchTab('/pages/index/index')">
				<image :src="baseUrl+'home.png'" class="homeImg" />
				<text class="homeLabel">首页</text>
			</view>
			<view class="collectBox">
				<image :src="baseUrl+'share.png'" class="collectImg" />
				<text class="collectLabel">分享</text>
				<button open-type="share" class="transparent-btn"></button>
			</view>
			<view class="dingzhi" @click="openMini()">
				立即定制
			</view>
		</view>
	</view>
</template>
<script>
	import {
		baseURL,
		basePath
	} from '@/config/app'
	import {
		apiQuestionnaire
	} from "@/api/app";
	import Cache from "@/utils/cache";
	import {
		mapGetters,
		mapState
	} from 'vuex';
	import {
		INVITE_CODE
	} from '@/config/cachekey'
	export default {
		data() {
			return {
				baseUrl: `https://cdn.zkjialan.com/img/course/`,
			}
		},
		onShareAppMessage() {
			return {
				title: '邀您定制个人专属营养方案!',
				path: `/course/ai/ai?invite_code=${this.userInfo.code}`,
			}
		},
		onLoad() {
			if (uni.getLaunchOptionsSync().scene) { //来源场景
				Cache.set('scene', uni.getLaunchOptionsSync().scene)
			}
			if (uni.getLaunchOptionsSync().query.invite_code) { //获取邀请码
				Cache.set(INVITE_CODE, uni.getLaunchOptionsSync().query.invite_code)
			}
		},
		methods: {
			//半屏拉起ai小程序
			openMini(){
				if (!this.isLogin) return this.$Router.push('/pages/login/login')
				wx.openEmbeddedMiniProgram({
				    'appId':'wxccc1e457b03da613',      
				    'path':`pages/invitationLand/invitationLand?salesmanId=544852&o_id=${this.userInfo.sn}&phone=${this.userInfo.mobile}`,
				 })
			},
		}
	}
</script>
<style lang="scss" scoped>
	.menuBox {
		position: fixed;
		width: 750rpx;
		height: 140rpx;
		bottom: 0rpx;
		background-color: #fff;
		display: flex;
		z-index: 999999;
		padding-top: 20rpx;
		.dingzhi{
			width: 462rpx;
			height: 85rpx;
			background-color: #f08229;
			text-align: center;
			line-height: 85rpx;
			font-size: 26rpx;
			color: #fff;
			margin-left: 90rpx;
			border-radius: 42rpx;
		}
		.collectBox {
			position: relative;
			// width: 40rpx;
			height: 100%;
			margin-left: 45rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			.transparent-btn {
			  position: absolute;
			  top: 0;
			  left: 0;
			  width: 100%;
			  height: 100%;
			  opacity: 0;
			}
			.collectImg {
				width: 31rpx;
				height: 27rpx;
				margin-top: 13rpx;
			}
	
			.collectLabel {
				font-size: 19rpx;
				margin-top: 15rpx;
			}
		}
	
		.homeBox {
			// width: 40rpx;
			height: 100%;
			margin-left: 60rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
	
			.homeImg {
				width: 33rpx;
				height: 31rpx;
				margin-top: 10rpx;
			}
	
			.homeLabel {
				font-size: 19rpx;
				margin-top: 13rpx;
			}
		}
	}
	.aiInfo{
		width: 100%;
		height: 13243rpx;
	}
	.content {
		width: 100%;
		height: 100vh;
	}
</style>